Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tuyapi/openapi

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tuyapi/openapi

🚪 a wrapper for Tuya's OpenAPI

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

A TypeScript wrapper for Tuya's OpenAPI

XO code style Build Status

Why?

There is another package called @tuyapi/cloud. Why does this one exist?

The other package deals with Tuya's 'mobile' API, which has limited usefulness as Tuya seems to be phasing it out.

This package instead uses their 'OpenAPI', the solution that they recommend third-party applications use.

Installation

npm i @tuyapi/openapi

Example Usage

(The schema value is your unique app ID from the Tuya console.)

const OpenAPI = require('@tuyapi/openapi');

const api = new OpenAPI({key: '10101010', secret: '1010101010', schema: '10101010'});

(async () => {
  // Must be called before any other operations to get auth token
  await api.getToken();

  const uid = await api.putUser({
    countryCode: '1',
    username: '6124136341',
    password: 'c7fb2740c5fc45660d9e4ed765a479fa',
    usernameType: 1});

  console.log(uid);

  const token = await api.getDeviceToken({uid, timezone: 'America/Chicago'});

  console.log(token);

  console.log(await api.getDevicesByToken('EkjQjlbo'));
})();

Docs

FAQs

Package last updated on 31 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc